/*
 * hkh-project
 * leafteamwork.blogspot.com
 * Tool: Netbeans 6.7.1 - SQL Server 2005
 */
package vn.com.hkh.service;

import java.util.Collection;
import vn.com.hkh.dto.RoomDTO;
import vn.com.hkh.dao.RoomDAO;

/**
 *
 * @author leaf
 */
public class RoomService {

    RoomDAO roomDao = new RoomDAO();

    /**
     * Insert Room
     * @param _dto
     * @return RoomDTO
     */
    public RoomDTO create(RoomDTO _dto) {
        return roomDao.create(_dto);
    }

    /**
     * Update Room
     * @param _dto
     * @return RoomDTO
     */
    public RoomDTO store(RoomDTO _dto) {
        return roomDao.update(_dto);
    }

    /**
     * Update Room Status
     * @param _id
     * @param _status
     * @return boolean
     */
    public boolean store(String _id, Integer _status) {
        return roomDao.updateStatus(_id, _status);
    }

    /**
     * List all Rooms
     * @return Collection<UserDTO>
     */
    public Collection<RoomDTO> findRooms() {
        return roomDao.readByAll();
    }

    /**
     * List all Rooms by Status
     * @param _status
     * @return Collection<RoomDTO>
     */
    public Collection<RoomDTO> findByStatus(Integer _status) {
        return roomDao.readByStatus(_status);
    }

    /**
     * List all Rooms by Alias
     * @param _status
     * @return Collection<RoomDTO>
     */
    public Collection<RoomDTO> findByAlias(String _alias) {
        return roomDao.readByAlias(_alias);
    }

    /**
     * Find Room by Primary key
     * @param _id
     * @return RoomDTO
     */
    public RoomDTO findByPrimaryKey(String _id) {
        return roomDao.readByID(_id);
    }

    /**
     * Delete Room by Primary key
     * @param _id
     * @return boolean
     */
    public boolean remove(String _id) {
        return roomDao.deleteById(_id);
    }
}
